<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 ..\sdschemas\SDA.xsd">
    <#assign templateData={"title":"住院摘要", "code":"HSDC00.03", "templateId":"2.16.156.10011.2.1.1.18"}>
    <#include "fragment/header/header.ftl">
    <#include "fragment/header/componentOf.ftl">
    <component>
        <structuredBody>
            <!--症状章节-->
            <#--1..1-->
            <component>
                <section>
                    <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="PROBLEM LIST"/>
                    <text/>
                    <#--1..*-->
                    <#list docData.zhengZhuangList as zhengzhuang>
                        <entry>
                            <organizer moodCode="EVN" classCode="CLUSTER">
                                <statusCode/>
                                <component>
                                    <observation moodCode="EVN" classCode="OBS">
                                        <code code="DE04.01.118.00" codeSystem="2.16.156.10011.2.2.1" displayName="症状名称"
                                              codeSystemName="卫生信息数据元目录"/>
                                        <value xsi:type="ST">${zhengzhuang.zhengZhuangMC}</value>
                                    </observation>
                                </component>
                                <component>
                                    <observation moodCode="EVN" classCode="OBS">
                                        <code code="DE04.01.116.00" codeSystem="2.16.156.10011.2.2.1" displayName="症状代码"
                                              codeSystemName="卫生信息数据元目录"/>
                                        <value code="${zhengzhuang.zhengZhuangDM}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.3.11"
                                               displayName="${zhengzhuang.zhengZhuangMC}" codeSystemName="ICD-10"/>
                                    </observation>
                                </component>
                                <component>
                                    <observation moodCode="EVN" classCode="OBS">
                                        <code code="DE04.01.018.00" codeSystem="2.16.156.10011.2.2.1" displayName="发病开始日期"
                                              codeSystemName="卫生信息数据元目录"/>
                                        <#if zhengzhuang.kaiShiRQ??>
                                            <value xsi:type="TS" value="${zhengzhuang.kaiShiRQ}"/>
                                        <#else>
                                            <value xsi:type="TS"/>
                                        </#if>
                                    </observation>
                                </component>
<#--                                <#if templateData.templateId=='2.16.156.10011.2.1.1.18'>-->
<#--                                    <component>-->
<#--                                        <observation moodCode="EVN" classCode="OBS">-->
<#--                                            <code code="DE04.01.115.00" codeSystem="2.16.156.10011.2.2.1" displayName="症状持续时间"-->
<#--                                                  codeSystemName="卫生信息数据元目录"/>-->
<#--                                            <#if zhengzhuang.zhengZhuangCXSJ?? && zhengzhuang.zhengZhuangCXSJ!=''>-->
<#--                                                <value unit="min" xsi:type="PQ" value="${zhengzhuang.zhengZhuangCXSJ}"/>-->
<#--                                            <#else>-->
<#--                                                <value unit="min" xsi:type="PQ" value="0"/>-->
<#--                                            </#if>-->
<#--                                        </observation>-->
<#--                                    </component>-->
<#--                                </#if>-->
                            </organizer>
                        </entry>
                    </#list>
                </section>
            </component>
            <!--实验室检查章节-->
            <#--0..1-->
            <#if docData.shiYanShiJCJYList??>
            <component>
                <section>
                    <code code="30954-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="STUDIES SUMMARY"/>
                    <text/>
                    <#--0..1-->
                    <#include "fragment/body/shiyanshijiancha/shiyanshijiancha.ftl">
                    <#--0..*-->
                    <#list docData.shiYanShiJCJYList as item>
                        <#include "fragment/body/shiyanshijiancha/shiyanshijiancha-xmjjg.ftl">
                    </#list>
                </section>
            </component>
            </#if>
            <!--诊断记录章节-->
            <#--0..1-->
            <#if docData.zhenDuanList??>
            <component>
                <section>
                    <code code="29548-5" displayName="Diagnosis" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
                    <text/>
                    <#list docData.zhenDuanList as item>
                    <!--条目：诊断-->
                    <#--1..1-->
                    <#if item.zhenDuanDM??>
                    <entry>
                        <organizer moodCode="EVN" classCode="CLUSTER">
                            <statusCode/>
                            <component>
                                <observation moodCode="EVN" classCode="OBS">
                                    <code code="DE05.01.025.00" codeSystem="2.16.156.10011.2.2.1" displayName="诊断名称" codeSystemName="卫生信息数据元目录"/>
                                    <effectiveTime value="${item.queZhenSJ}"/>
                                    <value xsi:type="ST">${item.zhenDuanMC}</value>
                                </observation>
                            </component>
                            <component>
                                <observation moodCode="EVN" classCode="OBS">
                                    <code code="DE05.01.024.00" codeSystem="2.16.156.10011.2.2.1" displayName="诊断代码" codeSystemName="卫生信息数据元目录"/>
                                    <value code="${item.zhenDuanDM}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.3.11" displayName="${item.zhenDuanMC}" codeSystemName="ICD-10"/>
                                </observation>
                            </component>
                        </organizer>
                    </entry>
                    </#if>
                    <#if item.chuanRanXBZ??>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE05.01.119.00" displayName="住院者传染性标志" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="BL" value="${item.chuanRanXBZ}"></value>
                        </observation>
                    </entry>
                    </#if>
                    <#if item.jiBingZTDM??>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE05.01.072.00" displayName="住院者疾病状态代码" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${item.jiBingZTDM.code}" codeSystem="2.16.156.10011.2.3.1.100"
                                   displayName="${item.jiBingZTDM.displayName}" codeSystemName="住院者疾病状态代码表"></value>
                        </observation>
                    </entry>
                    </#if>
                    <#if item.bingQingZGDM??>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE05.10.113.00" displayName="治疗结果代码" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${item.bingQingZGDM.code}" codeSystem="2.16.156.10011.2.3.1.148"
                                   displayName="${item.bingQingZGDM.displayName}" codeSystemName="病情转归代码表"></value>
                        </observation>
                    </entry>
                    </#if>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE06.00.016.00" displayName="出院日期" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="TS" value="${item.chuYuanSJ}"/>
                        </observation>
                    </entry>
                    <#if item.siWangZDDM??>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE05.01.021.00" displayName="根本死因代码" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="CD" code="${item.siWangZDDM.code}" codeSystem="2.16.156.10011.2.3.3.11"
                                   displayName="${item.siWangZDDM.displayName}" codeSystemName="ICD-10"></value>
                        </observation>
                    </entry>
                    </#if>
                    <#if item.siWangZDDM??>
                    <entry>
                        <observation classCode="OBS" moodCode="EVN">
                            <code code="DE02.01.036.00" displayName="死亡日期时间" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
                            <value xsi:type="TS" value="${item.siWangSJ}"/>
                        </observation>
                    </entry>
                    </#if>
                    </#list>
                </section>
            </component>
            </#if>
            <!--会诊原因章节 -->
            <#--0..1-->
            <#if docData.huiZhenYY??>
                <component>
                    <section>
                        <code code="DE06.00.039.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="会诊原因"/>
                        <text>${docData.huiZhenYY}</text>
                    </section>
                </component>
            </#if>
            <!--会诊意见章节-->
            <#--0..1-->
            <#if docData.huiZhenYJ??>
                <component>
                    <section>
                        <code code="DE06.00.038.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="会诊意见"/>
                        <text/>
                        <entry>
                            <observation classCode="OBS" moodCode="PRP">
                                <code/>
                                <!--会诊日期-->
                                <effectiveTime value="${docData.huiZhenYJ.huiZhenRQ}"/>
                                <value xsi:type="ST">${docData.huiZhenYJ.huiZhenYJ}</value>
                                <performer>
                                    <assignedEntity>
                                        <id/>
                                        <!--会诊医生姓名-->
                                        <assignedPerson>
                                            <name>${docData.huiZhenYJ.huiZhenYSXM}</name>
                                        </assignedPerson>
                                        <representedOrganization>
                                            <name>${docData.huiZhenYJ.shenQingKSMC}</name>
                                            <asOrganizationPartOf>
                                                <!-- 会诊医生所在医疗机构名称 -->
                                                <wholeOrganization>
                                                    <id root="2.16.156.10011.1.5" extension="${docData.huiZhenYJ.huiZhenYSSZJGDM}"/>
                                                    <name>${docData.huiZhenYJ.huiZhenYSSZJGMC}</name>
                                                </wholeOrganization>
                                            </asOrganizationPartOf>
                                        </representedOrganization>
                                    </assignedEntity>
                                </performer>
                            </observation>
                        </entry>
                    </section>
                </component>
            </#if>
            <!--用药章节 -->
            <#--1..1-->
            <#if docData.yongYao??>
                <#list docData.yongYao as yongyao>
            <component>
                <section>
                    <code code="10160-0" codeSystem="2.16.840.1.113883.6.1" displayName="HISTORY OF MEDICATION USE" codeSystemName="LOINC"/>
                    <text/>
                    <#--0..*-->
                    <#list yongyao.zhongYaoSYLBList as item>
                        <#include "fragment/body/yongyao/yongyao-zylb.ftl">
                    </#list>
                    <#--1..*-->
                    <#list yongyao.yongYaoItemList as item>
                        <#include "fragment/body/yongyao/yongyao.ftl">
                    </#list>
                </section>
            </component>
                </#list>
            </#if>
            <!-- 手术操作章节 -->
            <#--0..1-->
            <#if docData.shouShuList??>
            <component>
                <section>
                    <code code="47519-4" displayName="HISTORY OF PROCEDURES" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" />
                    <text/>
                    <#--0..*-->
                    <#list docData.shouShuList as item>
<#--                        <#include "fragment/body/shoushucaozuo/shoushucaozuo.ftl">-->
                        <entry>
                            <!-- 1..1 手术记录 -->
                            <procedure classCode="PROC" moodCode="EVN">
                                <!-- 手术（操作）代码 -->
                                <code code="${item.shouShuCZ.code}" codeSystem="2.16.156.10011.2.3.3.12" codeSystemName="手术(操作)代码表(ICD-9-CM)" displayName="${item.shouShuCZ.displayName}"/>
                                <statusCode/>
                                <!--操作日期/时间-->
                                <effectiveTime value="${item.caoZuoSJ}"/>
                                <entryRelationship typeCode="COMP">
                                    <observation classCode="OBS" moodCode="EVN">
                                        <code code="DE06.00.094.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="手术（操作）名称"/>
                                        <value xsi:type="ST">${item.caoZuoMC}</value>
                                    </observation>
                                </entryRelationship>
                                <!-- 0..1 麻醉信息 -->
                                <entryRelationship typeCode="COMP">
                                    <observation classCode="OBS" moodCode="EVN">
                                        <code code="DE06.00.074.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="麻醉方法名称"/>
                                        <value xsi:type="ST">${item.maZuiFFMC}</value>
                                    </observation>
                                </entryRelationship>
                                <entryRelationship typeCode="COMP" >
                                    <observation classCode="OBS" moodCode="EVN">
                                        <code code="DE06.00.073.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="麻醉方法代码"/>
                                        <value code="${item.maZuiFF.code}" codeSystem="2.16.156.10011.2.3.1.159" codeSystemName="麻醉方法代码表" xsi:type="CD" displayName="${item.maZuiFF.displayName}"></value>
                                    </observation>
                                </entryRelationship>
                            </procedure>
                        </entry>
                    </#list>
                </section>
            </component>
            </#if>
            <!-- 其他处置章节 -->
            <#--0..*-->
            <#if docData.qiTaYXCZList??>
                <#--0..*-->
                <#list docData.qiTaYXCZList as item>
                    <#include "fragment/body/qitayixuechuzhi/qitayixuechuzhi.ftl">
                </#list>
            </#if>
            <!--转诊建议章节-->
            <#--0..1-->
            <#if docData.zhuanZhenJY??>
            <component>
                <section>
                    <code code="18776-1" codeSystem="2.16.840.1.113883.6.1" displayName="referal" codeSystemName="LOINC"/>
                    <text/>
                    <!-- 转诊过程 -->
                    <#--0..1-->
                    <#include "fragment/body/zhuanzhenjianyi/zhuanzhenjianyi-zzgcms.ftl">
                    <#--0..1-->
                    <#include "fragment/body/zhuanzhenjianyi/zhuanzhenjianyi.ftl">
                </section>
            </component>
            </#if>
            <!-- 健康评估章节 -->
            <#--0..1-->
            <#if docData.jianKangPG??>
            <component>
                <section>
                    <code code="51848-0" displayName="Assessment note" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
                    <text/>
                    <#include "fragment/body/jiankangpinggu/jiankangpinggu.ftl">
                </section>
            </component>
            </#if>
            <!--治疗计划章节-->
            <#--1..1-->
            <#if docData.zhiLiaoJH??>
                <component>
                    <section>
                        <code code="18776-5" codeSystem="2.16.840.1.113883.6.1" displayName="TREATMENT PLAN" codeSystemName="LOINC"/>
                        <text/>
                        <#--0..1-->
                        <#include "fragment/body/zhiliaojihua/zhiliaojihua-zlfa.ftl">
                    </section>
                </component>
            </#if>
            <!--健康指导章节-->
            <#--0..1-->
            <#if docData.jianKangZDList??>
            <component>
                <section>
                    <code code="69730-0" codeSystem="2.16.840.1.113883.6.1" displayName="Instructions" codeSystemName="LOINC"/>
                    <text/>
                    <#--0..*-->
                    <#list docData.jianKangZDList as item>
                        <#include "fragment/body/jiankangzhidao/jiankangzhidao.ftl">
                    </#list>
                </section>
            </component>
            </#if>
            <!--费用章节 -->
            <#--1..1-->
            <#if docData.feiYongList??>
                <#list docData.feiYongList as item>
                    <component>
                        <section>
                            <code code="48768-6" displayName="PAYMENT SOURCES" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
                            <text/>
                            <#list item.feiYongTMList as fy>
                            <entry>
                                <organizer classCode="CLUSTER" moodCode="EVN">
                                    <statusCode/>
                                    <component>
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="DE07.00.009.00" codeSystem="2.16.156.10011.2.2.1"
                                                  codeSystemName="卫生信息数据元目录" displayName="住院费用分类名称"></code>
                                            <value xsi:type="ST">${fy.zhuYuanFYFLMC}</value>
                                        </observation>
                                    </component>
                                    <component>
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="DE07.00.008.00" codeSystem="2.16.156.10011.2.2.1"
                                                  codeSystemName="卫生信息数据元目录" displayName="住院费用分类代码"></code>
                                            <value code="${fy.zhuYuanFYFL.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.269" displayName="${fy.zhuYuanFYFL.displayName}" codeSystemName="医疗付费方式代码表"/>
                                        </observation>
                                    </component>
                                </organizer>
                            </entry>
                            </#list>
                            <entry>
                                <observation classCode="OBS" moodCode="EVN">
                                    <code code="DE07.00.007.00" codeSystem="2.16.156.10011.2.2.1"
                                          codeSystemName="卫生信息数据元目录" displayName="医疗付款方式代码" ></code>
                                    <value code="${item.yiLiaoFKFS.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.197" displayName="${item.yiLiaoFKFS.displayName}" codeSystemName="医疗费用来源类别代码表"/>
                                </observation>
                            </entry>
                            <entry>
                                <observation classCode="OBS" moodCode="EVN">
                                    <code code="DE07.00.006.00" codeSystem="2.16.156.10011.2.2.1"
                                          codeSystemName="卫生信息数据元目录" displayName="住院费用结算方式代码"/>
                                    <value code="${item.zhuYuanFYJSFS.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.198" displayName="${item.zhuYuanFYJSFS.displayName}" codeSystemName="医疗费用结算方式代码表"/>
                                </observation>
                            </entry>
                            <entry>
                                <observation classCode="OBS" moodCode="EVN">
                                    <code code="DE07.00.010.00" codeSystem="2.16.156.10011.2.2.1"
                                          codeSystemName="卫生信息数据元目录" displayName="住院费用金额"/>
                                    <value value="${item.zhuYuanFYJE}" currency="元" xsi:type="MO"/>
                                </observation>
                            </entry>
                        </section>
                    </component>
                </#list>
            </#if>
        </structuredBody>
    </component>
</ClinicalDocument>